import request from '@/utils/request'
// 登陆/注册

// 通过code获取openId
export function wXGetOpenId(code) {
  return request({
    url: '/maintenance/wXContrller/getOpenId',
    method: 'get',
    params: { code },
    port: { ENV_PORT: 8005 },
    // ajaxType2: 'reqGet'
    xOrgId: 1
  })
}

// 账号登陆
export function login({ account, code, codeKey, password }) {
  return request({
    url: '/authority/login/account',
    method: 'post',
    params: { account, code, codeKey, password }
  })
}

// 注销（退出登陆）
export function loginOut({ userId }) {
  return request({
    url: '/authority/login/out',
    method: 'post',
    params: { userId }
  })
}

// 登陆 --- 发送手机验证码
export function logPhoneCode(phoneNumber) {
  return request({
    url: '/authority/login/phone/code',
    method: 'post',
    params: { phoneNumber }
  })
}

// 手机登陆
export function phoneLogin({ code, phoneNumber }) {
  return request({
    url: '/authority/login/phone',
    method: 'post',
    params: { code, phoneNumber }
  })
}

// 微信登陆
export function wxLogin({ wxId }) {
  return request({
    url: '/authority/login/wx',
    method: 'post',
    params: { wxId }
  })
}

// 注册
export function register({ account, code, password, phoneNumber, sysId, userName }) {
  return request({
    url: '/authority/register',
    method: 'post',
    params: { account, code, password, phoneNumber, sysId, userName }
  })
}

// 注册 --- 下一步
export function regNext({ code, phoneNumber }) {
  return request({
    url: '/authority/register/next',
    method: 'post',
    params: { code, phoneNumber }
  })
}

// 注册 --- 发送手机验证码
export function regPhoneCode(phoneNumber) {
  return request({
    url: '/authority/register/phone/code',
    method: 'post',
    params: { phoneNumber }
  })
}

// 微信注册
export function wxRegister({ account, password, phoneNumber, sysId, userName, wxId }) {
  return request({
    url: '/authority/register/wx',
    method: 'post',
    params: { account, password, phoneNumber, sysId, userName, wxId }
  })
}

